import api from './index'
import request from '@/utils/request'

// 用户信息
export function getUserInfo() {
  return request({
    url: api.UserInfo,
    method: 'get',
    hideloading: true
  })
}

// 修改用户信息
export function updateUserInfo(params) {
  return request.post(api.UserInfo, params)
}

export function getContactInfo(uuid) {
  return request({
    url: api.ContactInfo,
    method: 'get',
    params: {
      uuid
    },
    hideloading: true
  })
}

export function logout() {
  return request({
    url: api.Logout,
    method: 'post'
  })
}

export function setAvatar(form) {
  const formData = new FormData()
  Object.keys(form).forEach(key => {
    formData.append(key, form[key])
  })
  return request.post(api.SetAvatar, formData)
}
// oldPassword newPassword newPasswordRep
export function updatePassword(form) {
  return request.post(api.UpdatePassword, form)
}
